﻿namespace Hrm.EntityFramework.MigrationsStudio
{
    using Hrm.Core;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    /// <summary>
    /// Add-Migration -configuration Hrm.EntityFramework.MigrationsStudio.Configuration Initial
    /// Update-Database -configuration Hrm.EntityFramework.MigrationsStudio.Configuration -Verbose
    /// </summary>
    internal sealed class Configuration : DbMigrationsConfiguration<Hrm.EntityFramework.StudioDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
            MigrationsDirectory = @"MigrationsStudio";
        }

        protected override void Seed(Hrm.EntityFramework.StudioDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            context.Services.AddOrUpdate(
              p => p.Name,
              new Service()
              {
                  Name="教学服务",
                  Description="我们提供HTML5,CSS3,JAVASCRIPT教学",
                  Glyphicon = "glyphicon glyphicon-user",
              }
            );
            //
        }
    }
}
